home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_084 / ed / getone.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  721b  |  46 lines

  1. /*
  2.  * Copyright 1987 Brian Beattie Rights Reserved.
  3.  *
  4.  * Permission to copy and/or distribute granted under the
  5.  * following conditions:
  6.  *
  7.  * 1). No charge may be made other than resonable charges
  8.  *    for reproduction.
  9.  *
  10.  * 2). This notice must remain intact.
  11.  *
  12.  * 3). No further restrictions may be added.
  13.  *
  14.  */
  15. #include <stdio.h>
  16. #include "tools.h"
  17. #include "ed.h"
  18.  
  19. getone()
  20. {
  21.     int    c, i, num;
  22.  
  23.     if((num = getnum()) >= 0)
  24.     {
  25.         while(1)
  26.         {
  27.             while(*inptr == SP || *inptr == HT)
  28.                 inptr++;
  29.  
  30.             if(*inptr != '+'&& *inptr != '-')
  31.                 break;
  32.                         c = *inptr++;
  33.  
  34.             if((i = getnum()) < 0)
  35.                 return ( i );
  36.             if(c == '+')
  37.             {
  38.                 num += i;
  39.             } else {
  40.                 num -= i;
  41.             }
  42.         }
  43.     }
  44.     return ( num );
  45. }
  46.